import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Test {
    public static void main(String[] args) {
        BinarySearchTree binarySearchTree=new BinarySearchTree();
        binarySearchTree.insert(3);
        binarySearchTree.insert(1);
        binarySearchTree.insert(2);
        binarySearchTree.insert(4);
        System.out.println(binarySearchTree.search(2).key);
        binarySearchTree.remove(2);
        System.out.println("aaa");

    }
    public static void main1(String[] args) {
        TreeMap<String,Integer>map=new TreeMap<>();
        map.put("hello",4);//h-104
        map.put("world",1);//w-119
        map.put("abc",7);//a-97
        //返回所以的Key-Value的映射关系
        Set< Map.Entry<String,Integer>>entrySet=map.entrySet();
        for (Map.Entry<String,Integer>entry:entrySet) {
            System.out.println("Key:"+entry.getKey()+" "+
                             "Value"+entry.getValue());
        }
    }
}
